#include <stdio.h>
#include "waveHelper.h"
struct FmtHeaderStr basicFmt = {
	{'f','m','t',0x20 },
	16,
	1,
	1,
	0x0000ac44,
	0x00015888,
	0x0002,
	16
};
struct WaveHeaderStr basicWH =
{
	{'R','I','F','F'},
	0,
	{'W','A','V','E'}
};
void writeWaveFile(short* data,int len,char* path)
{
	FILE* f = fopen(path,"wb");
	if(f)
	{
		unsigned int newlen = (len*sizeof(short));
		basicWH.wavLen=(len*sizeof(short))+sizeof(FmtHeader);
		fwrite(&basicWH,sizeof(WaveHeader),1,f);
		fwrite(&basicFmt,sizeof(FmtHeader),1,f);
		fwrite("data",sizeof(char),4,f);
		fwrite(&newlen,sizeof(int),1,f);
		fwrite(data,sizeof(short),(len),f);
		fclose(f);
	}
}